Applications
/* Name : main.c * Purpose : Source code for BUZZER Interfacing with AT89C52. * Author : Gemicates * Date : 2014-01-17 * Website : www.gemicates.com * Revision : None */ #include <REGX52.H> // header file for AT89c52 series #define input P1 sbit Buzzer=P3^2; // GPIO direction register declaration void delay(unsigned int count); void main() // main function { input = 0xFF; // Port 1 make as a output port while(1) { switch(input) // Switch statement { case 0xFE: Buzzer = 0; delay(100); Buzzer = 1; delay(100); break; case 0xFD: Buzzer = 0; delay(100); Buzzer = 1; delay(100); break; case 0xFB: Buzzer = 1; delay(100); Buzzer = 0; delay(100); break; case 0xF7: Buzzer = 1; delay(100); Buzzer = 0; delay(100); break; case 0xEF: Buzzer = 1; delay(100); Buzzer = 0; delay(100); break; case 0xDF: Buzzer = 1; delay(100); Buzzer = 0; delay(100); break; case 0xBF: Buzzer = 1; delay(100); Buzzer = 0; delay(100); break; case 0x7F: Buzzer = 1; delay(100); Buzzer = 0; delay(100); break; } } } void delay(unsigned int count) //delay function declaration { int i,j; for(i=0;i<count;i++) for(j=0;j<12750;j++); }